package pattern.template;

import lombok.Data;

/**
 * 模板模式抽象基类
 *
 * @author sun.ye
 * @since 2020-07-15 11:27
 */
@Data
public abstract class AbstractApplication {

    private boolean done;

    protected abstract void init();
    protected abstract void idle();
    protected abstract void cleanup();

    public void run(){
        init();
        while (!done){
            idle();
        }
        cleanup();
    }
}
